package charTest;

import org.junit.Test;

import java.math.BigDecimal;
import java.util.regex.Pattern;

/**
 * 对一个字符的正则
 * ^[0-9]{1,}$
 */
public class test2 {
    @Test
    public void test(){
        if(Pattern.matches("^[0-9]{1,}$","4")){
            System.out.println("ture");
        }else{
            System.out.println("false");
        }
    }

    @Test
//    将"23423"转换为32432 不能使用pae
    public void test2(){
        String test ="1234576";
        int s = Integer.valueOf(test);
        System.out.println(s);

        StringBuffer ss =new StringBuffer(test);
        System.out.println(ss.reverse());


    }

    public static void main(String[] args) {
//        long 类型最大值乘以 2
//        处理两个Long类型相乘溢出的问题
        long maxValue = Long.MAX_VALUE;
//        BigDecimal bd = new BigDecimal(String.valueOf(maxValue));
//        BigDecimal bd2 = bd.multiply( new BigDecimal(2));
//        BigDecimal bd3 =bd.add(bd);
//        System.out.println(bd3);
//        System.out.println(bd2);
        StringBuffer sb = new StringBuffer("dfdsfads,");
        sb.deleteCharAt(sb.length()-1);
        System.out.println(sb);
    }
}
